﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Utilities;

namespace Home.Domain.Entities
{
    /// <summary>
    /// 网站信息
    /// </summary>
    public class WebSite
    {
        public WebSite()
        {
            XElement booksFromFile = XElement.Load(Common.Current.Server.MapPath(@"~/App_Data/xml/WebSite.xml"));
            Title = booksFromFile.Descendants("Title").First().Value;
            Logo = booksFromFile.Descendants("Logo").First().Value;
        }
        /// <summary>
        /// 标题
        /// </summary>
        string Title { get; set; }
        /// <summary>
        /// Logo
        /// </summary>
        string Logo { get; set; }
        /// <summary>
        /// 保存配置
        /// </summary>
        public void Save()
        {
            XElement booksFromFile = XElement.Load(Common.Current.Server.MapPath(@"~/App_Data/xml/WebSite.xml"));
            booksFromFile.Descendants("Title").First().SetValue(Title);
            booksFromFile.Descendants("Logo").First().SetValue(Logo);
            booksFromFile.Save(Common.Current.Server.MapPath(@"~/App_Data/xml/WebSite.xml"));
        }
    }
}
